package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.ObjectImages;



public class ObjectImagesDao extends IbatisDao{
	
	public List selectObjectImages() throws SQLException {
		List selectObjectImages = null;
		selectObjectImages =getSqlMap().queryForList("SELECT_ALL_OBJECTIMAGES", null);
		return selectObjectImages;
	}

	public int deleteObjectImages(ObjectImages objectImages) throws SQLException{
		return (int) getSqlMap().delete("DELETE_OBJECTIMAGES", objectImages);
	}
	
	public int updateObjectImages(ObjectImages objectImages) throws SQLException{
		return (int) getSqlMap().update("UPDATE_OBJECTIMAGES", objectImages);
	}
	
	public ObjectImages insertObjectImages(ObjectImages objectImages) throws SQLException{
		return (ObjectImages) getSqlMap().insert("INSERT_OBJECTIMAGES", objectImages);
	}
		
	public static void main (String args[]) throws SQLException{
		ObjectImages objectImages;
		List<ObjectImages> weh;
		objectImages = new ObjectImages();
		//objectImages.setName("Coba dari Main");
		weh = new ObjectImagesDao().selectObjectImages();
		System.out.println(weh.size());
		
		//insert
		/*objectImages.setSourceId(3);
		new ObjectImagesDao().insertObjectImages(objectImages);
		}*/
	
		//update
		objectImages.setImageId(1);
		objectImages.setDescription("jelek!!!");
		new ObjectImagesDao().updateObjectImages(objectImages);
	
		objectImages.setImageId(1);
		new ObjectImagesDao().deleteObjectImages(objectImages);
	}
	
}